package com.ymatou.iapi.prodstock.service;

import java.util.List;

import com.google.common.reflect.TypeToken;
import com.ymatou.iapi.prodstock.parameter.CatalogStockDto;
import com.ymt.base.YmatouBaseCall;
import com.ymt.core.tool.FormatUtil;
import com.ymttest.utils.EnvSetup;
/**
*通过商品活动编号列表查询规格活动库存列表Call
*FreeMaker Template自动生成代码
*/
public class GetCatalogStockByProductInActivityIdListCall extends YmatouBaseCall{
	private static String opurl ="api/Product/GetCatalogStockByProductInActivityIdList";
	
	public GetCatalogStockByProductInActivityIdListCall() {
		super(EnvSetup.getSystemUrl("prodstock"),opurl,"POST","JSON");
	}
	@Override
	public void addDefHeader() {
		client.addHeader("Accept","text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}
	
	public List<CatalogStockDto> getCatalogStockList(){
		String sResults=getJsonObject().get("Data").getAsJsonObject().get("CatalogStockList").getAsJsonArray().toString();
		List<CatalogStockDto> FreezeProductResultList=(List<CatalogStockDto>) FormatUtil.GSONToObject(sResults, new TypeToken<List<CatalogStockDto>>(){}.getType());
		return FreezeProductResultList;
	}
	
}